<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="employee.js"></script>
    <script>
        function $(id){
            return document.getElementById(id);
        }

        window.onload = function (){
            var str = "";
            //n表示数组中的元素，index为序号
            emArray.forEach((n,index) =>{
                str += `<tr><td>${index}</td><td>${n.code}</td><td>${n.name}</td>
                    <td>${n.job}</td><td>${n.money}</td></tr>`;
            });
            $("data").innerHTML = str;
        }

        // var code = "001";
        // var s1 = "<td>" + code + "</td>";
        // //模版字符串，引号为ESC键下面的键
        // var s2 = `<td>${code}</td>`;
        // console.log(s1+"   "+s2);
    </script>
</head>
<body>
    <table border="1" width="80%" cellspacing="0">
        <thead>
            <tr><th>序号</th></th><th>编号</th><th>姓名</th><th>职位</th><th>工资</th></tr>
        </thead>
        <tbody id="data"></tbody>
    </table>
</body>
</html>